package com.hishop.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hishop.common.utils.PageUtils;
import com.hishop.order.dao.OmsOrderDao;
import com.hishop.order.entity.OmsOrderEntity;
import com.hishop.order.service.OmsOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service("omsOrderService")
public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderDao, OmsOrderEntity> implements OmsOrderService {

    @Resource
    private OmsOrderDao omsOrderDao;
    @Override
    public PageUtils queryPage(String key, Page<OmsOrderEntity> page) {
//         IPage<OmsOrderEntity> query = new Query<OmsOrderEntity>().getPage(params);
//
//        IPage<OmsOrderEntity> page = this.page(
//                query,
//                new QueryWrapper<OmsOrderEntity>()
//        );
        QueryWrapper<OmsOrderEntity> qw = new QueryWrapper<>();
        if (!key.equals("")) {
            qw.like("order_sn", key);
        }
        return new PageUtils(omsOrderDao.selectPage(page,qw));
    }

}